package licode.unisop.log.client.feign;

import licode.unisop.log.client.dto.AuditLogDTO;
import licode.unisop.log.client.dto.CallingLogDTO;
import licode.unisop.log.client.dto.LoginLogDTO;
import licode.unisop.types.AuthConst;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 适配RESTFUL接口访问，处理用户的注册和登录
 *
 * @author WR
 */
@FeignClient(name = "${uni-sop.log.service:log-service}", url = "${uni-sop.log.host:}")
public interface LogOpFeign {

    @PostMapping("/auth-log/api/v1/audit/save")
    void saveAudit(@RequestParam(AuthConst.PLATFORM_TOKEN) String platformId,
                   @RequestBody AuditLogDTO data);

    @PostMapping("/auth-log/api/v1/call-api/save")
    void saveCallApi(@RequestParam(AuthConst.PLATFORM_TOKEN) String platformId,
                     @RequestBody CallingLogDTO data);

    @PostMapping("/auth-log/api/v1/login/save")
    void saveLogin(@RequestParam(AuthConst.PLATFORM_TOKEN) String platformId,
                   @RequestBody LoginLogDTO data);
}
